/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Daniel Cruz
 */
@Entity
@Table(name = "b_perfil")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BPerfil.findAll", query = "SELECT b FROM BPerfil b"),
    @NamedQuery(name = "BPerfil.findByPerId", query = "SELECT b FROM BPerfil b WHERE b.perId = :perId"),
    @NamedQuery(name = "BPerfil.findByPerNombre", query = "SELECT b FROM BPerfil b WHERE b.perNombre = :perNombre"),
    @NamedQuery(name = "BPerfil.findByPerEstado", query = "SELECT b FROM BPerfil b WHERE b.perEstado = :perEstado"),
    @NamedQuery(name = "BPerfil.findByPerDescripcion", query = "SELECT b FROM BPerfil b WHERE b.perDescripcion = :perDescripcion")})
public class BPerfil implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "per_id")
    private Long perId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "per_nombre")
    private String perNombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "per_estado")
    private String perEstado;
    @Size(max = 255)
    @Column(name = "per_descripcion")
    private String perDescripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "perId")
    private Collection<BLogin> bLoginCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bPerfil")
    private Collection<BPermisoMenu> bPermisoMenuCollection;

    public BPerfil() {
    }

    public BPerfil(Long perId) {
        this.perId = perId;
    }

    public BPerfil(Long perId, String perNombre, String perEstado) {
        this.perId = perId;
        this.perNombre = perNombre;
        this.perEstado = perEstado;
    }

    public Long getPerId() {
        return perId;
    }

    public void setPerId(Long perId) {
        this.perId = perId;
    }

    public String getPerNombre() {
        return perNombre;
    }

    public void setPerNombre(String perNombre) {
        this.perNombre = perNombre;
    }

    public String getPerEstado() {
        return perEstado;
    }

    public void setPerEstado(String perEstado) {
        this.perEstado = perEstado;
    }

    public String getPerDescripcion() {
        return perDescripcion;
    }

    public void setPerDescripcion(String perDescripcion) {
        this.perDescripcion = perDescripcion;
    }

    @XmlTransient
    public Collection<BLogin> getBLoginCollection() {
        return bLoginCollection;
    }

    public void setBLoginCollection(Collection<BLogin> bLoginCollection) {
        this.bLoginCollection = bLoginCollection;
    }

    @XmlTransient
    public Collection<BPermisoMenu> getBPermisoMenuCollection() {
        return bPermisoMenuCollection;
    }

    public void setBPermisoMenuCollection(Collection<BPermisoMenu> bPermisoMenuCollection) {
        this.bPermisoMenuCollection = bPermisoMenuCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (perId != null ? perId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BPerfil)) {
            return false;
        }
        BPerfil other = (BPerfil) object;
        if ((this.perId == null && other.perId != null) || (this.perId != null && !this.perId.equals(other.perId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.BPerfil[ perId=" + perId + " ]";
    }
    
}
